/*
 * IMGLoader.hpp
 *
 *  Created on: 28.09.2013
 *      Author: dima
 */

#ifndef IMGLOADER_HPP_
#define IMGLOADER_HPP_


#include "../Model/GameObjectModel.hpp"

#include <SDL/SDL.h>
#include <SDL/SDL_image.h>

#include <vector>
#include <string>


namespace Tanks
{

namespace Resources
{

  enum ImageType
  {
    Player,
    TankEasy,
    TankMedium,
    TankHard,
    Missile,
    Explosion,
    ExplosionTank,
    ImageTypeEnd
  };

  class IMGLoader
  {
  public:

    static IMGLoader & getInstance();

    ~IMGLoader();

    SDL_Surface * GetImage(ImageType argImageType)
      {return m_images[argImageType];}

    void Load(std::string argDir);

    SDL_Surface * LoadImage(std::string argFilename, bool const argTransparent);

  private:

    IMGLoader(){}

    void AddSurface(std::string argImgFilename, bool argTransparent);

    // !Precondition argImg must not be NULL
    SDL_Surface * ConvertImage(SDL_Surface * argImg);

    std::vector<SDL_Surface *> m_images;

  };




}

}


#endif /* IMGLOADER_HPP_ */
